package cn.leaf.strategy;

import java.math.BigDecimal;

/**
*
 * description: 维护策略上下文
 *
 * @author twinkle leaf
 * @version v1.0.0
 * @since 2021-07-15 22:33:16
 *
*/
public class DiscountContext {

    // Spring框架
//    @Resource
//    private Map<String, DiscountStrategy> discountStrategyMap;

    private final DiscountStrategy discountStrategy;

    public DiscountContext(DiscountStrategy discountStrategy) {
        this.discountStrategy = discountStrategy;
    }

    public BigDecimal getPrice(BigDecimal originalPrice) {
        return discountStrategy.getPrice(originalPrice);
    }
}
